import { ethers } from "ethers";
import MintTask from "../Utils/Task.js";
import { PrintLog } from "../Utils/Utils.js";

const MintData = "";
const MintRpc = "";
const Gwei = "350";
const DiyGasPrice = true; //是否自定义GasPrice
const MintProvider = new ethers.providers.JsonRpcProvider(MintRpc); //先初始化链接对象，不然后面初始化占用太多链接
/**
 *
 * @param {*} AccountObj 自定义的账号操作对象
 * @param {*} index 当前处理到的账号索引
 */
async function Main(AccountObj, index) {
  PrintLog(`当前处理到第 【${index}】个账号，地址为${AccountObj.address}`);
  const wallet = new ethers.Wallet(AccountObj.privateKey, MintProvider); //初始化钱包
  const tx = {
    to: wallet.address,
    gasLimit: ethers.utils.hexlify(30000),
    gasPrice: ethers.utils.hexlify(ethers.utils.parseUnits(Gwei, "gwei")), //也可以动态获取链上的GasPrice
    data: MintData,
  };
  try {
    const signTx = await wallet.signTransaction(tx);
  } catch (error) {}
}
const accounts = [
  { address: "0x000", privateKey: "0x000" },
  { address: "0x001", privateKey: "0x001" },
  { address: "0x002", privateKey: "0x002" },
  { address: "0x003", privateKey: "0x003" },
  { address: "0x004", privateKey: "0x004" },
  { address: "0x005", privateKey: "0x005" },
  { address: "0x006", privateKey: "0x006" },
  { address: "0x007", privateKey: "0x007" },
  { address: "0x008", privateKey: "0x008" },
  { address: "0x009", privateKey: "0x009" },
  { address: "0x010", privateKey: "0x010" },
  { address: "0x011", privateKey: "0x011" },
  { address: "0x012", privateKey: "0x012" },
  { address: "0x013", privateKey: "0x013" },
  { address: "0x014", privateKey: "0x014" },
];

MintTask.startTask(accounts, 1, 1, Main);
